<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of mmw_controller_FrontController
 *
 * @author Manu
 */
require_once(dirname(__FILE__)."/mmw_controller_Request.php");
require_once(dirname(__FILE__)."/../command/mmw_command_CommandResolver.php");

class mmw_controller_FrontController {
    public static function run() {
        $instance=new mmw_controller_FrontController();
        $instance->init();
        $instance->handleRequest();
    }
    
    private function init() {}
    
    private function handleRequest() {
        try {
        $request=new mmw_controller_Request();
        $cmd_r=new mmw_command_CommandResolver();
        $cmd=$cmd_r->getCommand($request);
        $cmd->execute($request);
        }
        catch (Exception $e) {
            $request->setSuccess(false);
            $request->addFeedback($e->getMessage());
        }
    }
}

?>
